Results 1 to 7 of 7

Thread: QFileDialog How to hide linux hidden/backup folders (“.folder”)

  1. #1
    Join Date
    Jun 2010
    Posts
    36
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default QFileDialog How to hide linux hidden/backup folders (“.folder”)

    Basically when browsing folders inside a QFileDialog I find very annoying to have everything bloated with hidden or backup folders (don't know how to call them really); specially on "home" where programs leave their data...

    Is there a way to prevent these type of folders (the ones who start with a dot) from showing by default on a QFileDialog?

    I'm using Qt4.6, getOpenFileName and Ubuntu 10.04.

    P.D.: I spent a couple hours looking for this on the web but found nothing.
    Last edited by toglia3d; 11th June 2010 at 10:05.

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: QFileDialog How to hide linux hidden/backup folders (“.folder”)

    Quote Originally Posted by toglia3d View Post
    P.D.: I spent a couple hours looking for this on the web but found nothing.
    33 seconds it took to find:
    http://doc.qt.nokia.com/4.6/qfiledialog.html#setFilter
    which points to
    http://doc.qt.nokia.com/4.6/qdir.html#Filter-enum

    ;-)

  3. #3
    Join Date
    Jun 2010
    Posts
    36
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QFileDialog How to hide linux hidden/backup folders (“.folder”)

    Am I not excluding hidden folders with this?
    Qt Code:
    1. QFileDialog openDialog;
    2. openDialog.setFilter(QDir::Dirs | QDir::Files);
    3. htmlFile = openDialog.getOpenFileName(
    4. this,
    5. tr("Open html file"),
    6. rutaCargarSetting,
    7. tr("*.html *.htm")
    8. );
    To copy to clipboard, switch view to plain text mode 

    Doesn't seem to work. I also tried something like:
    Qt Code:
    1. htmlFile = openDialog.getOpenFileName(
    2. this,
    3. tr("Open html file"),
    4. rutaCargarSetting,
    5. tr("*.html *.htm"),
    6. QDir::Dirs & QDir::Files
    7. );
    To copy to clipboard, switch view to plain text mode 

    Doesn't work either.

  4. #4
    Join Date
    Jun 2010
    Posts
    36
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QFileDialog How to hide linux hidden/backup folders (“.folder”)

    Sorry for that. it Actually does work. But the getOpenFileName probably is overriding the filters...

    I will have to manually exec the dialog.

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QFileDialog How to hide linux hidden/backup folders (“.folder”)

    QFileDialog::getOpenFileNames() is a static method and (QDir::Dirs & QDir::Files) = 0.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. #6
    Join Date
    Jun 2010
    Posts
    36
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QFileDialog How to hide linux hidden/backup folders (“.folder”)

    This is off topic.

    I find incredibly weird that native dialogs are only intended to show with the static methods. And as I read there is no workaround.

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QFileDialog How to hide linux hidden/backup folders (“.folder”)

    Sure there is a workaround. Use the native API. Is there something in particular you are missing in the static call?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 3
    Last Post: 26th August 2010, 11:51
  2. Replies: 2
    Last Post: 22nd July 2009, 20:16
  3. QFileDialog->leftPane()->hide() anything like this?
    By killerwookie99 in forum Qt Programming
    Replies: 1
    Last Post: 26th January 2009, 18:41
  4. Replies: 1
    Last Post: 5th October 2007, 09:51
  5. QFileDialog hidden files
    By blukske in forum Qt Programming
    Replies: 3
    Last Post: 8th March 2007, 02:11

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.